//
//  Kylin_LoginRegisterTextField.m
//  03-BuDeJie-2 TabBar设置
//
//  Created by Kylin on 16/2/5.
//  Copyright © 2016年 kylin. All rights reserved.
//

#import "Kylin_LoginRegisterTextField.h"
#define KYLINPlaceholderColor @"placeholderLabel.textColor"
#define KYLINPlaceDefaultColor [UIColor grayColor]
#define KYLINPlaceFoucsColor [UIColor whiteColor]

@implementation Kylin_LoginRegisterTextField

- (void)awakeFromNib{
    
    self.tintColor = KYLINPlaceDefaultColor;
    self.textColor = KYLINPlaceDefaultColor;
    
    // 利用KVC找到私有的成员变量
    [self setValue:[UIColor grayColor] forKeyPath:KYLINPlaceholderColor];
    
    [self resignFirstResponder];
  
}

// 当文本框聚焦成为第一响应者的时侯调用
- (BOOL)becomeFirstResponder{
    
    [self setValue:KYLINPlaceFoucsColor forKeyPath:KYLINPlaceholderColor];
    
   return  [super becomeFirstResponder];
}


// 当文本框失去聚集时侯调用
- (BOOL)resignFirstResponder{
    
    [self setValue:KYLINPlaceDefaultColor forKeyPath:KYLINPlaceholderColor];
    
    return [super resignFirstResponder];
}
@end
